/**
 * Created by WangMing on 15/12/9.
 */
define(["../../service",
  "../../widgets/search_table_widget/search_table_widget"

  ], function (api) {
  // 定义所有相关的vmodel
  var vm = avalon.define({
      $id: "videos",
      $breadcrumb: {
        stateName:"videos",
        guid: "",
        title: null // translation later in routers
      },
      finishLoad:false,
      
      results:{
         params:{
            method: api.getVideos,
            query:{
                OrderType: 0,
                DataType: 1,
                PageSize:12

            }
          }
      },

      displayPage:function(state){
        return state.vmName == "videos";
      }
    });

 
  return avalon.controller(function ($ctrl) {
    // 视图渲染后，意思是avalon.scan完成
    $ctrl.$onRendered = function () {

    };
    // 进入视图
    $ctrl.$onEnter = function (param, rs, rj) { 
      

      setTimeout(function(){
        vm.finishLoad = true;
      },100)
    };
    // 对应的视图销毁前
    $ctrl.$onBeforeUnload = function () {
      vm.fadein = false;
    };
    $ctrl.$vmodels = [vm];
  })
});